package com.ronghuanet.gift.properties;

import com.ronghuanet.gift.constants.LoginConstants;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "oauth2.client")
@Data
public class Oauth2ClientDetailsProperties {
    private Oauth2ClientDetails system;
    private Oauth2ClientDetails website;

    /**
     * 通过类型获取Oauth2ClientDetails
     * @param type
     * @return
     */
    public Oauth2ClientDetails getOauth2ClientDetails(Integer type){

        switch (type){
            case LoginConstants.LOGIN_TYPE_ADMIN:
                return system;
            case LoginConstants.LOGIN_TYPE_USER:
                return website;
        }

        return null;
    }
}
